{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 读取Excel文件，假设文件名为 'data.xlsx'，并且你要读取的工作表是第一个工作表\n",
    "excel_file = 'd://data.xlsx'\n",
    "sheet_name = '2#' \n",
    "# 使用pandas读取Excel文件\n",
    "df = pd.read_excel(excel_file, sheet_name=sheet_name, skiprows=2, header=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<bound method NDFrame.head of       序号       房号  建筑面积（平方米）  单价（元/平方米）     房屋总价\n",
       "0      1  2-10101     116.43      15710  1829115\n",
       "1      2  2-10102      96.42      14880  1434730\n",
       "2      3  2-10103      96.42      14880  1434730\n",
       "3      4  2-10104     116.43      15780  1837265\n",
       "4      5  2-10201     116.43      16210  1887330\n",
       "..   ...      ...        ...        ...      ...\n",
       "243  244  2-23004     116.43      18080  2105054\n",
       "244  245  2-23101     116.43      16980  1976981\n",
       "245  246  2-23102      96.42      16080  1550434\n",
       "246  247  2-23103      96.42      16080  1550434\n",
       "247  248  2-23104     116.43      17180  2000267\n",
       "\n",
       "[248 rows x 5 columns]>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>序号</th>\n",
       "      <th>建筑面积（平方米）</th>\n",
       "      <th>单价（元/平方米）</th>\n",
       "      <th>房屋总价</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>248.000000</td>\n",
       "      <td>248.000000</td>\n",
       "      <td>248.000000</td>\n",
       "      <td>2.480000e+02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>124.500000</td>\n",
       "      <td>106.425000</td>\n",
       "      <td>17552.701613</td>\n",
       "      <td>1.873066e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>71.735626</td>\n",
       "      <td>10.025233</td>\n",
       "      <td>856.045635</td>\n",
       "      <td>2.411924e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>96.420000</td>\n",
       "      <td>14880.000000</td>\n",
       "      <td>1.434730e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>62.750000</td>\n",
       "      <td>96.420000</td>\n",
       "      <td>17130.000000</td>\n",
       "      <td>1.661317e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>124.500000</td>\n",
       "      <td>106.425000</td>\n",
       "      <td>17580.000000</td>\n",
       "      <td>1.769321e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>186.250000</td>\n",
       "      <td>116.430000</td>\n",
       "      <td>18280.000000</td>\n",
       "      <td>2.128340e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>248.000000</td>\n",
       "      <td>116.430000</td>\n",
       "      <td>18860.000000</td>\n",
       "      <td>2.195870e+06</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               序号   建筑面积（平方米）     单价（元/平方米）          房屋总价\n",
       "count  248.000000  248.000000    248.000000  2.480000e+02\n",
       "mean   124.500000  106.425000  17552.701613  1.873066e+06\n",
       "std     71.735626   10.025233    856.045635  2.411924e+05\n",
       "min      1.000000   96.420000  14880.000000  1.434730e+06\n",
       "25%     62.750000   96.420000  17130.000000  1.661317e+06\n",
       "50%    124.500000  106.425000  17580.000000  1.769321e+06\n",
       "75%    186.250000  116.430000  18280.000000  2.128340e+06\n",
       "max    248.000000  116.430000  18860.000000  2.195870e+06"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/v5/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"f73a763e2176418380c77841d94127d6\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_f73a763e2176418380c77841d94127d6 = echarts.init(\n",
       "                    document.getElementById('f73a763e2176418380c77841d94127d6'), 'white', {renderer: 'canvas'});\n",
       "                var option_f73a763e2176418380c77841d94127d6 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    116.43,\n",
       "                    1829115\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1434730\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1434730\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1837265\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1887330\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1473298\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1473298\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1883837\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2027046\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1569718\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1569718\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2000267\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2003760\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1976981\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2061975\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1598644\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1598644\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2035196\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2085261\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1617928\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1617928\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2058482\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2096904\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1627570\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1627570\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2070125\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2108547\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2081768\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2120190\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1646854\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1646854\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2093411\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2126012\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1651675\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1651675\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2099233\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2131833\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1656496\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1656496\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2105054\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2137655\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2110876\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2143476\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1666138\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1666138\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2116697\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2114369\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1642033\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1642033\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2087590\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2155119\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2128340\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2160941\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2134162\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2166762\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2139983\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2137655\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2110876\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2178405\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2151626\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2184227\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2157448\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2190048\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2163269\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2195870\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1709527\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1709527\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2169091\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2190048\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2163269\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2184227\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2157448\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2178405\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2151626\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2172584\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1690243\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1690243\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2145805\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2166762\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2139983\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2160941\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2134162\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2155119\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2128340\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2108547\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2081768\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2003760\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1976981\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1837265\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1434730\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1434730\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1860551\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1883837\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1473298\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1473298\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1907123\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2000267\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1569718\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1569718\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2023553\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1976981\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2000267\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2035196\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1598644\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1598644\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2058482\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2058482\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1617928\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1617928\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2081768\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2070125\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1627570\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1627570\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2093411\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2081768\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2105054\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2093411\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1646854\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1646854\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2116697\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2099233\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1651675\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1651675\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2122519\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2105054\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1656496\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1656496\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2128340\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2110876\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2134162\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2116697\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1666138\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1666138\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2139983\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2087590\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1642033\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1642033\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2110876\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2128340\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2151626\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2134162\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2157448\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2139983\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2163269\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2110876\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1661317\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2134162\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2151626\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2174912\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2157448\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2180734\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2163269\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2186555\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2169091\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1709527\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1709527\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2192377\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2163269\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1704706\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2186555\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2157448\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1699885\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2180734\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2151626\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1695064\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2174912\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2145805\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1690243\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1690243\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2169091\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2139983\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1685422\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2163269\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2134162\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1680601\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2157448\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2128340\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1675780\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2151626\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2081768\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1637212\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2105054\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    1976981\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    96.42,\n",
       "                    1550434\n",
       "                ],\n",
       "                [\n",
       "                    116.43,\n",
       "                    2000267\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"right\",\n",
       "                \"margin\": 8,\n",
       "                \"valueAnimation\": false\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"type\": \"value\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"animation\": true,\n",
       "            \"animationThreshold\": 2000,\n",
       "            \"animationDuration\": 1000,\n",
       "            \"animationEasing\": \"cubicOut\",\n",
       "            \"animationDelay\": 0,\n",
       "            \"animationDurationUpdate\": 300,\n",
       "            \"animationEasingUpdate\": \"cubicOut\",\n",
       "            \"animationDelayUpdate\": 0,\n",
       "            \"data\": [\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43,\n",
       "                116.43,\n",
       "                96.42,\n",
       "                96.42,\n",
       "                116.43\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"animation\": true,\n",
       "            \"animationThreshold\": 2000,\n",
       "            \"animationDuration\": 1000,\n",
       "            \"animationEasing\": \"cubicOut\",\n",
       "            \"animationDelay\": 0,\n",
       "            \"animationDurationUpdate\": 300,\n",
       "            \"animationEasingUpdate\": \"cubicOut\",\n",
       "            \"animationDelayUpdate\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_f73a763e2176418380c77841d94127d6.setOption(option_f73a763e2176418380c77841d94127d6);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2747f7f1070>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Scatter\n",
    "from pyecharts import options as opts\n",
    "\n",
    "s = (\n",
    "    Scatter()\n",
    "    .add_xaxis(df['建筑面积（平方米）'].values.tolist())\n",
    "    .add_yaxis('',df['房屋总价'].values.tolist())\n",
    "    .set_global_opts(xaxis_opts=opts.AxisOpts(type_='value'))\n",
    "    )\n",
    "s.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>单价（元/平方米）</th>\n",
       "      <th>建筑面积（平方米）</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>69.000000</td>\n",
       "      <td>69.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>17677.971014</td>\n",
       "      <td>110.460980</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>951.241572</td>\n",
       "      <td>8.920273</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>14880.000000</td>\n",
       "      <td>96.420000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>17180.000000</td>\n",
       "      <td>98.643333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>17930.000000</td>\n",
       "      <td>116.430000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>18410.000000</td>\n",
       "      <td>116.430000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>18860.000000</td>\n",
       "      <td>116.430000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          单价（元/平方米）   建筑面积（平方米）\n",
       "count     69.000000   69.000000\n",
       "mean   17677.971014  110.460980\n",
       "std      951.241572    8.920273\n",
       "min    14880.000000   96.420000\n",
       "25%    17180.000000   98.643333\n",
       "50%    17930.000000  116.430000\n",
       "75%    18410.000000  116.430000\n",
       "max    18860.000000  116.430000"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "# 假设你想要绘制的两列分别是 '建筑面积（平方米）' 和 '单价（元/平方米）'\n",
    "grouped_df = df.groupby('单价（元/平方米）')['建筑面积（平方米）'].mean().reset_index()\n",
    "\n",
    "grouped_df.describe()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>单价（元/平方米）</th>\n",
       "      <th>建筑面积（平方米）</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>14880</td>\n",
       "      <td>96.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>15280</td>\n",
       "      <td>96.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>15710</td>\n",
       "      <td>116.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>15780</td>\n",
       "      <td>116.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>15980</td>\n",
       "      <td>116.43</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   单价（元/平方米）  建筑面积（平方米）\n",
       "0      14880      96.42\n",
       "1      15280      96.42\n",
       "2      15710     116.43\n",
       "3      15780     116.43\n",
       "4      15980     116.43"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grouped_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X 数据 (单价): [14880, 15280, 15710, 15780, 15980, 16080, 16180, 16210, 16280, 16380, 16580, 16780, 16880, 16980, 17030, 17080, 17130, 17180, 17210, 17230, 17280, 17380, 17410, 17430, 17480, 17530, 17580, 17630, 17680, 17710, 17730, 17780, 17880, 17910, 17930, 17980, 18010, 18030, 18080, 18110, 18130, 18160, 18180, 18210, 18230, 18260, 18280, 18310, 18330, 18360, 18380, 18410, 18430, 18480, 18510, 18530, 18560, 18580, 18610, 18630, 18660, 18680, 18710, 18730, 18760, 18780, 18810, 18830, 18860]\n",
      "Y 数据 (建筑面积): [96.42, 96.42, 116.43, 116.43, 116.43, 96.42, 116.43, 116.43, 96.42, 116.43, 96.42, 96.42, 96.42, 103.08999999999999, 96.42, 96.42, 96.42, 106.42500000000001, 116.43, 96.42, 96.42, 98.64333333333333, 116.43, 96.42, 100.422, 96.42, 96.42, 96.42, 101.87727272727274, 116.43, 96.42, 116.43, 116.43000000000002, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43000000000002, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43000000000002, 116.43, 116.43, 116.43, 116.43000000000002, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43, 116.43]\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/v5/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"040aec89e4ea4db69a5530478abbc624\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_040aec89e4ea4db69a5530478abbc624 = echarts.init(\n",
       "                    document.getElementById('040aec89e4ea4db69a5530478abbc624'), 'white', {renderer: 'canvas'});\n",
       "                var option_040aec89e4ea4db69a5530478abbc624 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5e73\\u5747\\u5efa\\u7b51\\u9762\\u79ef\",\n",
       "            \"connectNulls\": false,\n",
       "            \"xAxisIndex\": 0,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": true,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    14880,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    15280,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    15710,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    15780,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    15980,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    16080,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    16180,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    16210,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    16280,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    16380,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    16580,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    16780,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    16880,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    16980,\n",
       "                    103.08999999999999\n",
       "                ],\n",
       "                [\n",
       "                    17030,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17080,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17130,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17180,\n",
       "                    106.42500000000001\n",
       "                ],\n",
       "                [\n",
       "                    17210,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    17230,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17280,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17380,\n",
       "                    98.64333333333333\n",
       "                ],\n",
       "                [\n",
       "                    17410,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    17430,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17480,\n",
       "                    100.422\n",
       "                ],\n",
       "                [\n",
       "                    17530,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17580,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17630,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17680,\n",
       "                    101.87727272727274\n",
       "                ],\n",
       "                [\n",
       "                    17710,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    17730,\n",
       "                    96.42\n",
       "                ],\n",
       "                [\n",
       "                    17780,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    17880,\n",
       "                    116.43000000000002\n",
       "                ],\n",
       "                [\n",
       "                    17910,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    17930,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    17980,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18010,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18030,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18080,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18110,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18130,\n",
       "                    116.43000000000002\n",
       "                ],\n",
       "                [\n",
       "                    18160,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18180,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18210,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18230,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18260,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18280,\n",
       "                    116.43000000000002\n",
       "                ],\n",
       "                [\n",
       "                    18310,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18330,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18360,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18380,\n",
       "                    116.43000000000002\n",
       "                ],\n",
       "                [\n",
       "                    18410,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18430,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18480,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18510,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18530,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18560,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18580,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18610,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18630,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18660,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18680,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18710,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18730,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18760,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18780,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18810,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18830,\n",
       "                    116.43\n",
       "                ],\n",
       "                [\n",
       "                    18860,\n",
       "                    116.43\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8,\n",
       "                \"valueAnimation\": false\n",
       "            },\n",
       "            \"logBase\": 10,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5e73\\u5747\\u5efa\\u7b51\\u9762\\u79ef\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"axis\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u5355\\u4ef7\\uff08\\u5143/\\u5e73\\u65b9\\u7c73\\uff09\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"animation\": true,\n",
       "            \"animationThreshold\": 2000,\n",
       "            \"animationDuration\": 1000,\n",
       "            \"animationEasing\": \"cubicOut\",\n",
       "            \"animationDelay\": 0,\n",
       "            \"animationDurationUpdate\": 300,\n",
       "            \"animationEasingUpdate\": \"cubicOut\",\n",
       "            \"animationDelayUpdate\": 0,\n",
       "            \"data\": [\n",
       "                14880,\n",
       "                15280,\n",
       "                15710,\n",
       "                15780,\n",
       "                15980,\n",
       "                16080,\n",
       "                16180,\n",
       "                16210,\n",
       "                16280,\n",
       "                16380,\n",
       "                16580,\n",
       "                16780,\n",
       "                16880,\n",
       "                16980,\n",
       "                17030,\n",
       "                17080,\n",
       "                17130,\n",
       "                17180,\n",
       "                17210,\n",
       "                17230,\n",
       "                17280,\n",
       "                17380,\n",
       "                17410,\n",
       "                17430,\n",
       "                17480,\n",
       "                17530,\n",
       "                17580,\n",
       "                17630,\n",
       "                17680,\n",
       "                17710,\n",
       "                17730,\n",
       "                17780,\n",
       "                17880,\n",
       "                17910,\n",
       "                17930,\n",
       "                17980,\n",
       "                18010,\n",
       "                18030,\n",
       "                18080,\n",
       "                18110,\n",
       "                18130,\n",
       "                18160,\n",
       "                18180,\n",
       "                18210,\n",
       "                18230,\n",
       "                18260,\n",
       "                18280,\n",
       "                18310,\n",
       "                18330,\n",
       "                18360,\n",
       "                18380,\n",
       "                18410,\n",
       "                18430,\n",
       "                18480,\n",
       "                18510,\n",
       "                18530,\n",
       "                18560,\n",
       "                18580,\n",
       "                18610,\n",
       "                18630,\n",
       "                18660,\n",
       "                18680,\n",
       "                18710,\n",
       "                18730,\n",
       "                18760,\n",
       "                18780,\n",
       "                18810,\n",
       "                18830,\n",
       "                18860\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u5efa\\u7b51\\u9762\\u79ef\\uff08\\u5e73\\u65b9\\u7c73\\uff09\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"animation\": true,\n",
       "            \"animationThreshold\": 2000,\n",
       "            \"animationDuration\": 1000,\n",
       "            \"animationEasing\": \"cubicOut\",\n",
       "            \"animationDelay\": 0,\n",
       "            \"animationDurationUpdate\": 300,\n",
       "            \"animationEasingUpdate\": \"cubicOut\",\n",
       "            \"animationDelayUpdate\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"\\u76f8\\u540c\\u5355\\u4ef7\\u4e0b\\u7684\\u5e73\\u5747\\u5efa\\u7b51\\u9762\\u79ef\\u6298\\u7ebf\\u56fe\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_040aec89e4ea4db69a5530478abbc624.setOption(option_040aec89e4ea4db69a5530478abbc624);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x27408aa3610>"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Line\n",
    "from pyecharts import options as opts\n",
    "\n",
    "# 确保列名与 DataFrame 中的实际名称一致\n",
    "y_data = grouped_df['建筑面积（平方米）'].tolist()  # Y轴应该是建筑面积\n",
    "x_data = grouped_df['单价（元/平方米）'].tolist()    # X轴应该是单价\n",
    "\n",
    "# 打印数据以进行调试，确保数据正确无误\n",
    "print(\"X 数据 (单价):\", x_data)\n",
    "print(\"Y 数据 (建筑面积):\", y_data)\n",
    "\n",
    "# 创建折线图对象\n",
    "line_chart = (\n",
    "    Line()\n",
    "    .add_xaxis(xaxis_data=x_data)  # X轴数据（单价）\n",
    "    .add_yaxis(\n",
    "        series_name=\"平均建筑面积\",  # 系列名称\n",
    "        y_axis=y_data,  # Y轴数据（建筑面积）\n",
    "        is_smooth=True,  # 是否平滑曲线\n",
    "        label_opts=opts.LabelOpts(is_show=False),  # 不显示标签\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"相同单价下的平均建筑面积折线图\"),\n",
    "        tooltip_opts=opts.TooltipOpts(trigger=\"axis\"),  # 提示框组件配置项\n",
    "        xaxis_opts=opts.AxisOpts(name=\"单价（元/平方米）\"),  # X轴名称\n",
    "        yaxis_opts=opts.AxisOpts(name=\"建筑面积（平方米）\"),  # Y轴名称\n",
    "    )\n",
    ")\n",
    "\n",
    "# 在Jupyter Notebook中直接显示图表\n",
    "line_chart.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   单价（元/平方米）  建筑面积（平方米）\n",
      "0      14880      96.42\n",
      "1      15280      96.42\n",
      "2      15710     116.43\n",
      "3      15780     116.43\n",
      "4      15980     116.43\n",
      "['单价（元/平方米）', '建筑面积（平方米）']\n"
     ]
    }
   ],
   "source": [
    "# 打印 DataFrame 的前几行以确认数据是否正确读取\n",
    "print(grouped_df.head())\n",
    "\n",
    "# 确认列名是否正确\n",
    "print(grouped_df.columns.tolist())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "是否存在空值： False\n",
      "          单价（元/平方米）   建筑面积（平方米）\n",
      "count     69.000000   69.000000\n",
      "mean   17677.971014  110.460980\n",
      "std      951.241572    8.920273\n",
      "min    14880.000000   96.420000\n",
      "25%    17180.000000   98.643333\n",
      "50%    17930.000000  116.430000\n",
      "75%    18410.000000  116.430000\n",
      "max    18860.000000  116.430000\n"
     ]
    }
   ],
   "source": [
    "# 检查是否有空值\n",
    "print(\"是否存在空值：\", grouped_df.isnull().values.any())\n",
    "\n",
    "# 如果有空值，可以考虑删除含有缺失值的行\n",
    "grouped_df = grouped_df.dropna()\n",
    "\n",
    "# 查看统计数据，找出可能存在的问题\n",
    "print(grouped_df.describe())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X 数据长度: 69\n",
      "Y 数据长度: 69\n"
     ]
    }
   ],
   "source": [
    "x_data = grouped_df['单价（元/平方米）'].tolist()\n",
    "y_data = grouped_df['建筑面积（平方米）'].tolist()\n",
    "\n",
    "# 确认数据长度是否一致\n",
    "print(\"X 数据长度:\", len(x_data))\n",
    "print(\"Y 数据长度:\", len(y_data))\n",
    "\n",
    "if len(x_data) != len(y_data):\n",
    "    print(\"警告：X轴和Y轴的数据长度不一致\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "数据预览：\n",
      "   单价（元/平方米）  建筑面积（平方米）\n",
      "0      14880      96.42\n",
      "1      15280      96.42\n",
      "2      15710     116.43\n",
      "3      15780     116.43\n",
      "4      15980     116.43\n",
      "X 数据 (单价): [14880, 15280, 15710, 15780, 15980]\n",
      "Y 数据 (建筑面积): [96.42, 96.42, 116.43, 116.43, 116.43]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'d:\\\\workspace\\\\learning\\\\python-learning\\\\jupyter\\\\simple_line_chart.html'"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Line\n",
    "from pyecharts import options as opts\n",
    "\n",
    "# 打印确认数据是否正确\n",
    "data = [\n",
    "    (14880, 96.42),\n",
    "    (15280, 96.42),\n",
    "    (15710, 116.43),\n",
    "    (15780, 116.43),\n",
    "    (15980, 116.43)\n",
    "]\n",
    "df = pd.DataFrame(data, columns=['单价（元/平方米）', '建筑面积（平方米）'])\n",
    "\n",
    "print(\"数据预览：\")\n",
    "print(df)\n",
    "\n",
    "# 对数据进行分组并计算每个单价对应的平均建筑面积\n",
    "grouped_df = df.groupby('单价（元/平方米）')['建筑面积（平方米）'].mean().reset_index()\n",
    "\n",
    "# 准备数据\n",
    "x_data = grouped_df['单价（元/平方米）'].tolist()\n",
    "y_data = grouped_df['建筑面积（平方米）'].tolist()\n",
    "\n",
    "# 打印数据以进行调试，确保数据正确无误\n",
    "print(\"X 数据 (单价):\", x_data)\n",
    "print(\"Y 数据 (建筑面积):\", y_data)\n",
    "\n",
    "# 创建折线图对象\n",
    "line_chart = (\n",
    "    Line()\n",
    "    .add_xaxis(xaxis_data=x_data)  # X轴数据（单价）\n",
    "    .add_yaxis(\n",
    "        series_name=\"平均建筑面积\",\n",
    "        y_axis=y_data,  # Y轴数据（建筑面积）\n",
    "        is_smooth=True,  # 是否平滑曲线\n",
    "        label_opts=opts.LabelOpts(is_show=False),  # 不显示标签\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"相同单价下的平均建筑面积折线图\"),\n",
    "        tooltip_opts=opts.TooltipOpts(trigger=\"axis\"),  # 提示框组件配置项\n",
    "        xaxis_opts=opts.AxisOpts(name=\"单价（元/平方米）\"),  # X轴名称\n",
    "        yaxis_opts=opts.AxisOpts(name=\"建筑面积（平方米）\"),  # Y轴名称\n",
    "    )\n",
    ")\n",
    "\n",
    "# 在Jupyter Notebook中直接显示图表\n",
    "line_chart.render_notebook()\n",
    "line_chart.render('simple_line_chart.html')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
